// MyIOCP.h: interface for the MyIOCP class.
//
//////////////////////////////////////////////////////////////////////
#ifndef MYIOCP_H
#define MYIOCP_H


#include "IOCPS.h"





class MyIOCP : public IOCPS  
{
public:
    MyIOCP();
    virtual ~MyIOCP();

    /*
    inherited interfaces
    */
    // Called to do some work. 
    virtual inline void ProcessJob(JobItem* pJob, IOCPS* pServer);
    // logger
    virtual void AppendLog(const char* fmt, ...);

    // A new connection have been established
    virtual void NotifyNewConnection(ClientContext* pcontext);
    // A client have connected
	virtual void NotifyNewClientContext(ClientContext* pContext);
	// A client have disconnected
	virtual void NotifyDisconnectedClient(ClientContext* pContext);
	// A Package have arrived. 
	virtual void NotifyReceivedPackage(CIOCPBuffer* pOverlapBuff, int nSize, ClientContext* pContext);	

    
	//send  
	BOOL SendDataToOneClient( ClientContext* pContext, unsigned char *pData, unsigned char len );

	BOOL SendDataToOneClient( unsigned char  *uIP, unsigned char *pData, unsigned char len );

	BOOL SendDataToAllClient( unsigned char *pData, unsigned char len );


	BOOL AddSendDataToWorkThread(  unsigned char  *uIP, unsigned char *pData, unsigned char len );

    /*
    * customize package processing
    */
	// Text in a Package is arrived. 
	void Packagetext(CIOCPBuffer* pOverlapBuff, int nSize, ClientContext* pContext);
	
  
	public:
	unsigned char cal_fcc(unsigned char *dest,unsigned char dest_len) ;


	BOOL SendDataToWorkThread( unsigned char  *uIP);
	

public:
    HWND m_hWnd;
	unsigned short  m_uNbr;
private:
	//CIOCPBuffer m_sendDatabuffer;
 
};

#endif // MYIOCP_H